import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace AiTrainingDatasetTagApi {
  /** 数据集标签信息 */
  export interface TrainingDatasetTag {
    id: number; // 标签ID
    name?: string; // 标签名称
    icon: string; // 标签图标
    color: string; // 颜色
    sort: number; // 排序
    systemFlag?: boolean; // 是否系统内置
    datasetCount: number; // 数据集个数
  }
}

/** 查询数据集标签分页 */
export function getTrainingDatasetTagPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<
    PageResult<AiTrainingDatasetTagApi.TrainingDatasetTag>
  >('/ai/training-dataset-tag/page', data, { desensitize, encrypt });
}

/** 查询数据集标签详情 */
export function getTrainingDatasetTag(id: number) {
  return requestClient.get<AiTrainingDatasetTagApi.TrainingDatasetTag>(
    `/ai/training-dataset-tag/get?id=${id}`,
  );
}

/** 新增数据集标签 */
export function createTrainingDatasetTag(
  data: AiTrainingDatasetTagApi.TrainingDatasetTag,
) {
  return requestClient.post('/ai/training-dataset-tag/create', data);
}

/** 修改数据集标签 */
export function updateTrainingDatasetTag(
  data: AiTrainingDatasetTagApi.TrainingDatasetTag,
) {
  return requestClient.put('/ai/training-dataset-tag/update', data);
}

/** 删除数据集标签 */
export function deleteTrainingDatasetTag(id: number) {
  return requestClient.delete(`/ai/training-dataset-tag/delete?id=${id}`);
}

/** 批量删除数据集标签 */
export function deleteTrainingDatasetTagList(ids: number[]) {
  return requestClient.delete(
    `/ai/training-dataset-tag/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出数据集标签 */
export function exportTrainingDatasetTag(params: any) {
  return requestClient.download('/ai/training-dataset-tag/export-excel', {
    params,
  });
}
